import request from '@/utils/request'
import requestOss from '@/utils/request-oss'

export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/admin/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/admin/logout',
    method: 'post'
  })
}

export function uploadToken(uploadType) {
  return request({
    url: '/admin/uploadtoken',
    method: 'get',
    params: { upload_type: uploadType }
  })
}

export function uploadOSS(url, data) {
  return requestOss({
    url: url,
    method: 'put',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: data
  })
}
